package com.travelms.service.adminuserpage;

import com.travelms.controller.AdminUserPage;
import com.travelms.dao.DBFind;

import java.io.IOException;
import java.sql.SQLException;
import java.util.Scanner;

public class ModifyAdminPsw {
    public ModifyAdminPsw() throws SQLException, IOException {
        Scanner sc = new Scanner(System.in);
        DBFind dbFind = new DBFind();
        while (true) {
            System.out.println("请输入你要修改的密码");
            String psw = sc.nextLine();

            if (psw.isEmpty()){
                System.out.println("不要输入空格，其他随意");
                continue;
            }
            dbFind.modifyAdminPsw(psw);
            System.out.println("修改成功");
            AdminUserPage.adminPasswordStatus = 1;
            System.out.println("信息发生改变请重新登录");
            System.out.println("将在3秒后自动退出");
            System.out.println("3");
            try {
                Thread.sleep(1000);
                System.out.println("2");
                Thread.sleep(1000);
                System.out.println("1");
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            break;

        }

    }
}
